function delComm() {
	var formId = "frm";
	if ($("#" + formId + " input[name='cIds']:checked").length <= 0) {
		_alert("请选择您要删除的记录");
		return false;
	}

	if ($("#" + formId + " input[name='cIds']:checked").length > 1) {
		_alert("小区关系信息很多，请确认单个删除");
		return;
	}

	if ($("input[name='cIds']:checked").length > 0) {
		_confirm("<span style='color:#FE6600'>是否删除当前记录</span>", function() {
			var _url = '/IMS/community/delComm.ht';
			var idArray = new Array();
			$('input:checkbox[name=cIds]:checked').each(function(index) {
				idArray[index] = $(this).val();
			});
			_url = _url + "?id=" + idArray;
			$.ajax({
				type : 'post',
				async : false,
				url : _url,
				dataType : 'json',
				beforeSend : function() {
					showProccessBar();
				},
				error : function() {
					hideProccessBar();
				},
				success : function(value) {
					var code = value.code;
					if (code == message_success_code) {
						var listUrl = '/IMS/community/showList.ht';
						$.go(listUrl, {
							dataType : 'html',
							error : function() {
								hideProccessBar();
							},
							success : function(data, textStatus) {
								replaceDocument(listUrl, data);
							}
						});
					} else {
						_alert(value.msg);
						hideProccessBar();
						return;
					}
				}
			});

		});
	} else {
		_alert("请选择待删除记录");
	}
}

function editComm(id, flag) {
	var url = "/IMS/community/showBaseInfoN.ht?cid=" + id;
	$.go(url, {
		dataType : 'html',
		beforeSend : function() {
			showProccessBar();
		},
		error : function() {
			hideProccessBar();
		},
		success : function(data, textStatus) {
			replaceDocument(url, data);
		}
	});
}

function showUploadPage() {
	hideProccessBar();
}

function batchAdd() {
	if ($("#uploadFile")) {
		$.submit($("#uploadForm"), {
			dataType : 'json',
			beforeSend : function() {
				showProccessBar();
			},
			error : function() {
				hideProccessBar();
			},
			success : function(data, textStatus) {
				if (data.code == '1') {
					_alert("导入失败 " + data.message);
					hideProccessBar();
				} else {
					_alert("导入成功", function() {
						if (data.result) {
							$("#downlandFile").attr("href", "/community/downlandResult.ht?batchId=" + data.result);
							$("#downland_li").show();
						}
					});
					hideProccessBar();
				}
			}
		});
	} else {
		_alert("请选择上传文件");
	}
}

function updateCommunity(id, pcid, status) {
	if (id != null) {
		var url = "/IMS/community/showBaseInfoN.ht?cid=" + id + "&pcid=" + pcid + "&status=" + status;
		$.go(url, {
			dataType : 'html',
			beforeSend : function() {
				showProccessBar();
			},
			error : function() {
				hideProccessBar();
			},
			success : function(data, textStatus) {
				replaceDocument(url, data);
			}
		});
	}

}

function searchSubmit() {
	/*
	var search = $("#search").val();
	if (Is_Null(search)) {
		_alert("请输入查询条件后再进行搜索");
		return;
	}
	*/
	$.submit($('#frm'), {
		dataType : 'html',
		beforeSend : function() {
			showProccessBar();
		},
		error : function() {
			hideProccessBar();
		},
		success : function(data, textStatus) {
			var url = $('#frm').attr('action');
			replaceDocument(url, data);
		}
	});
}